package com.lizemin.controller;

import com.lizemin.clients.ProductClient;
import com.lizemin.resp.Product;
import com.lizemin.resp.ProductResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @author lzm
 * @date 2025/4/17 22:10
 * @description
 */
@Slf4j
@RestController
public class ProductController implements ProductClient {

    @Override
    public ProductResp listProducts() {
        log.info("开始返回商品列表信息");
        ProductResp resp = new ProductResp();
        ArrayList<Product> products = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            Product product = new Product();
            int id = i + 1;
            product.setId(id);
            product.setName("商品-" + id);
            product.setDescription("商品描述-" + id);
            products.add(product);
        }
        resp.setProducts(products);
        return resp;
    }


}
